import { createSSRApp } from 'vue'
import { createPinia } from 'pinia'
import uviewPlus from 'uview-plus'
import App from './App'
import FloatingBall from './components/floating-ball/FloatingBall.vue'
import AiChat from './components/AiDialog/AiDialog.vue'

const pinia = createPinia()

export function createApp() {
  const app = createSSRApp(App)

  app.use(uviewPlus)
  app.use(pinia) // 确保Pinia正确注册

  // 注册全局组件
  app.component('FloatingBall', FloatingBall)
  app.component('AiChat', AiChat)

  return { app }
}